package com.moji.controller.api;


import com.moji.common.base.ApiResult;
import com.moji.entity.MjAboutUs;
import com.moji.entity.MjFlowConfig;
import com.moji.entity.dto.QueryFlowConfigDto;
import com.moji.service.MjFlowConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 流程审批表 前端控制器
 * </p>
 *
 * @author ccl
 * @since 2024-07-27
 */
@RestController
@RequestMapping("/api/mjFlowConfig")
@Api(tags = "审批流程配置", value = "审批流程配置api相关接口")
public class MjFlowConfigController {

    @Resource
    private MjFlowConfigService mjFlowConfigService;

    @PostMapping("/add")
    @ApiOperation(value = "流程配置_新增",response = Boolean.class)
    public ApiResult add(@Validated @RequestBody MjFlowConfig mjFlowConfig){
        return ApiResult.ok(mjFlowConfigService.add(mjFlowConfig));
    }

    @PostMapping("/edit")
    @ApiOperation(value = "流程配置_编辑",response = Boolean.class)
    public ApiResult edit(@Validated @RequestBody MjFlowConfig mjFlowConfig){
        return ApiResult.ok(mjFlowConfigService.edit(mjFlowConfig));
    }

    @GetMapping("/delete")
    @ApiOperation(value = "流程配置_删除",response = Boolean.class)
    public ApiResult delete(@RequestParam("id") Long id){
        return ApiResult.ok(mjFlowConfigService.delete(id));
    }

    @PostMapping("/queryByPage")
    @ApiOperation(value = "流程配置_分页查询",response = MjFlowConfig.class)
    public ApiResult queryByPage(@RequestBody QueryFlowConfigDto dto){
        return ApiResult.ok(mjFlowConfigService.queryByPage(dto));
    }

    @PostMapping("/detail")
    @ApiOperation(value = "流程配置_详情",response = MjFlowConfig.class)
    public ApiResult detail(@RequestParam("id") Long id){
        return ApiResult.ok(mjFlowConfigService.detail(id));
    }
}

